# !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2021/10/21 16:33
# @Author  : zuodengbo
# @Email   : zuofields@amoydx.com
# @File    : models
# @Software: PyCharm
from tortoise.models import Model
from tortoise import fields

from user import models as user_models
from utils.common import time_now


class BOrderSample(Model):
    """
    order sample model
    """
    LEVEL = (
        (1, "加急"),
        (2, "异常"),
        (3, "普通")
    )
    DELETE = (
        (0, "未废弃"),
        (1, "已废弃")
    )

    id = fields.IntField(pk=True, description="订单标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now, description="创建时间")
    order_id = fields.CharField(max_length=64, description="订单编号")
    specimen_type = fields.CharField(max_length=32, description="样品类型")
    specimen_amount = fields.CharField(max_length=32, description="样品数量")
    tumor_type = fields.CharField(max_length=128, description="肿瘤类型")
    tumor_names_cn = fields.CharField(max_length=128, description="肿瘤名称")
    tumor_ids = fields.CharField(max_length=200, description="肿瘤标识集合")
    prod_ids = fields.CharField(max_length=200, description="产品标识集合")
    prod_names = fields.CharField(max_length=128, description="产品名称")
    report_module_type = fields.CharField(max_length=64, description="订单来源")
    control_specimen_id = fields.CharField(max_length=64, description="对照样品编号")
    control_specimen_type = fields.CharField(max_length=64, description="对照样品类型")
    write_date = fields.DatetimeField(description="写入时间")
    creator: fields.ForeignKeyRelation["user_models.User"] = fields.ForeignKeyField(
        "models.User", related_name="creator_order_sample", description="创建用户")
    writer: fields.ForeignKeyRelation["user_models.User"] = fields.ForeignKeyField(
        "models.User", related_name="writer_order_sample", null=True, description="写入用户")
    level = fields.IntField(choices=LEVEL, default=3, description="优先级, 1-加急，2-异常，3-普通")
    remark = fields.TextField(null=True, description="订单备注信息")
    seqtype_code = fields.CharField(max_length=64, null=True, description="数据类别标号")
    current_status = fields.CharField(max_length=128, description="当前订单流程状态")
    current_status_code = fields.CharField(max_length=128, index=True, description="当前订单流程状态编码")
    age = fields.IntField(null=True, description="年龄")
    gender = fields.CharField(max_length=5, null=True, description="性别")
    patient_name = fields.CharField(max_length=32, null=True, description="患者姓名")
    prjoject_name = fields.CharField(max_length=64, null=True, description="项目名称")
    prod_unit_id = fields.IntField(description="产品单位编号")
    samp = fields.CharField(max_length=200, null=True, description="")
    specimen_id = fields.CharField(max_length=200, description="子样品编号")
    specimen_receive_data = fields.CharField(max_length=20, null=True, description="样品接收时间")
    prod_unit_ids = fields.CharField(max_length=256, description="产品单位编号集合")
    prod_unit_names = fields.CharField(max_length=256, description="产品单位名称集合")
    apply_code = fields.CharField(max_length=64, null=True, description="申请编号")
    company = fields.CharField(max_length=128, null=True, description="单位")
    company_code = fields.CharField(max_length=128, null=True, description="单位编号")
    pathological_id = fields.CharField(max_length=64, description="pathologicalNo 病理编号")
    specimen_gather = fields.CharField(max_length=20, null=True, description="gatherDt 采集时间")
    specimen_parent_id = fields.CharField(max_length=128, null=True, description="sampleSourceNo 总样品编号")
    origin_company = fields.CharField(max_length=128, description="applyCompanyNm，送检单位")
    rna_specimen_id = fields.CharField(max_length=64, null=True, description="rna子样品编号")
    audit_check_pdl1 = fields.CharField(max_length=32, default=0, description="该订单是否有审核数据上传的数据,现在默认是pd-l1的")
    APSPSampleInspectionApplyBill_id = fields.IntField(null=True, description=" bims APSPSampleInspectionApplyBill id")
    inspectionReportBackMark = fields.TextField(null=True, description="寄送备注")
    mark = fields.TextField(null=True, description="系统备注")
    prod_ids_detail = fields.CharField(max_length=256, null=True, description="产品编号详情")
    receiveCheckMark = fields.TextField(null=True, description="接收备注")
    sync_modify = fields.IntField(null=True, description="是否同步更新修改过，用于同步bims记录")
    hosp_depart = fields.CharField(max_length=128, null=True, description="科室信息")
    pathol_diagn = fields.TextField(null=True, description="病理诊断")
    report_number = fields.CharField(max_length=128, null=True, description="报告编号")
    sale_id = fields.IntField(null=True, description="销售id")
    sender = fields.CharField(max_length=64, null=True, description="送检人")
    telephone = fields.CharField(max_length=20, null=True, description="患者联系方式")
    json_batch_name = fields.CharField(max_length=100, null=True, description="批次编号")
    delete_time = fields.DatetimeField(null=True, description="废弃时间")
    is_delete = fields.IntField(choices=DELETE, default=0, description="数据是否废弃")
    control_specimen_amount = fields.CharField(max_length=256, null=True, description="对照样品数量")
    family_history = fields.TextField(null=True, description="家族史")
    mol_diagn_history = fields.TextField(null=True, description="既往分子检测结果")
    note = fields.TextField(null=True, description="说明")
    treatment_history = fields.TextField(null=True, description="用药史")

    audit_order: fields.ReverseRelation["AuditCheck"]
    audit_msg_order: fields.ReverseRelation["AuditMessage"]
    order_state: fields.ReverseRelation["BOrderState"]

    class Meta:
        table = "tbl_b_order_sample"


class BOrderState(Model):
    """
    Order state model
    """
    FLAG = (
        (0, "未操作"),
        (1, "操作中")
    )
    REVERT = (
        (0, "未撤回"),
        (1, "已撤回")
    )

    id = fields.IntField(pk=True, description="标识")
    order_sample: fields.ForeignKeyRelation["BOrderSample"] = \
        fields.ForeignKeyField("models.BOrderSample", related_name="order_state", description="订单标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    current_status = fields.CharField(max_length=32, description="当前订单流程状态")
    current_status_code = fields.CharField(max_length=64, index=True, description="当前订单流程状态编码")
    operate_status = fields.CharField(max_length=128, description="当前订单操作状态")
    operate_status_code = fields.CharField(max_length=128, index=True, description="当前订单操作状态编码")
    operator: fields.ForeignKeyRelation["user_models.User"] = \
        fields.ForeignKeyField("models.User", related_name="order_state_user", description="操作人标识")
    operate_flag = fields.IntField(choices=FLAG, default=0, description="是否正在操作")
    operate_start_time = fields.DatetimeField(description="操作开始时间")
    operate_status_current_time = fields.DatetimeField(description="操作状态当前时间")
    operate_end_time = fields.DatetimeField(description="操作结束时间")
    is_revert = fields.IntField(choices=REVERT, default=0, description="是否撤回")
    is_revert_variant = fields.IntField(choices=REVERT, null=True, description="是否撤回变异解读")
    operator_name = fields.CharField(max_length=32, description="操作人名字")
    is_revert_data = fields.IntField(choices=REVERT, default=0, description="是否撤回数据")

    class Meta:
        table = "tbl_b_order_state"
        indexes = ("order_sample_id", "current_status_code")
        unique_together = ("order_sample_id", "current_status_code")


class MET(Model):
    """
    MET model
    """
    SOURCE = (
        ("somatic", "体系"),
        ("germline", "胚系")
    )

    sq_no = fields.IntField(pk=True, description="序号标识")
    s_type_i = fields.CharField(max_length=50, description="样本类型")
    stage = fields.CharField(max_length=10, null=True, description="分类级别")
    tumor_type_i = fields.CharField(max_length=50, description="肿瘤类型i")
    tumor_type_ii = fields.CharField(max_length=50, description="肿瘤类型ii")
    tumor_type_iii = fields.CharField(max_length=50, description="肿瘤类型iii")
    source = fields.CharField(max_length=10, choices=SOURCE, default="somatic", description="肿瘤源")
    variant = fields.CharField(max_length=50, description="变异类型")
    type = fields.CharField(max_length=50, null=True, description="类型")
    classification = fields.CharField(max_length=50, description="分类方法")
    gene_symbol = fields.CharField(max_length=50, description="基因记号")
    chr = fields.CharField(max_length=50, description="染色体")
    chr_start = fields.CharField(max_length=50, description="染色体开始位置")
    chr_end = fields.CharField(max_length=50, description="染色体结束位置")
    exon = fields.CharField(max_length=50, description="外显子")
    exon_pos = fields.CharField(max_length=50, null=True, description="外显子位点")
    change_allele = fields.CharField(max_length=50, null=True, description="等位基因碱基变化")
    ref_allele = fields.CharField(max_length=50, description="等位基因参考")
    var_allele = fields.CharField(max_length=50, description="等位基因变化")
    refseq = fields.CharField(max_length=50, description="参考序列")
    c_dot = fields.CharField(max_length=50, description="编码DNA序列位点")
    p_dot = fields.CharField(max_length=50, null=True, description="蛋白质序列位点")

    class Meta:
        table = "tbl_p_met"


class AuditCheck(Model):
    """
    Audit check model
    """
    PASS = (
        (0, "未通过"),
        (1, "通过")
    )

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(description="创建日期")
    write_date = fields.DatetimeField(null=True, description="更新日期")
    create_uid = fields.IntField(description="创建用户标识")
    write_uid = fields.IntField(null=True, description="更新用户标识")
    order_id: fields.ForeignKeyRelation["BOrderSample"] = \
        fields.ForeignKeyField("models.BOrderSample", related_name="audit_order", description="订单标识")
    type: fields.ForeignKeyRelation["PDictPlatf"] = \
        fields.ForeignKeyField("models.PDictPlatf", related_name="audit_platform", description="外键标识")
    isPass = fields.IntField(choices=PASS, default=0, description="是否通过")

    class Meta:
        table = "tbl_audit_check"


class AuditMessage(Model):
    """
    Audit message model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(description="创建日期")
    write_date = fields.DatetimeField(null=True, description="更新日期")
    create_uid = fields.IntField(description="创建用户标识")
    write_uid = fields.IntField(null=True, description="更新用户标识")
    order_id: fields.ForeignKeyRelation["BOrderSample"] = \
        fields.ForeignKeyField("models.BOrderSample", related_name="audit_msg_order", description="订单标识")
    message = fields.TextField(null=True, description="消息内容")
    type = fields.CharField(max_length=32, null=True, description="类型")
    process = fields.CharField(max_length=32, null=True, description="流程阶段")

    class Meta:
        table = "tbl_audit_message"


class AuditMessageDict(Model):
    """
    Audit message dict model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(description="创建日期")
    write_date = fields.DatetimeField(null=True, description="更新日期")
    create_uid = fields.IntField(description="创建用户标识")
    write_uid = fields.IntField(null=True, description="更新用户标识")
    type = fields.CharField(max_length=32, description="类型")
    type_code = fields.CharField(max_length=32, description="类型编码")
    type_en = fields.CharField(null=True, max_length=128, description="对应英文")

    class Meta:
        table = "tbl_audit_message_dict"


class File(Model):
    """
    File model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(description="创建日期")
    write_date = fields.DatetimeField(null=True, description="更新日期")
    create_uid = fields.IntField(description="创建用户标识")
    write_uid = fields.IntField(null=True, description="更新用户标识")
    file_name = fields.CharField(max_length=64, description="文件名")
    full_path = fields.CharField(max_length=256, description="绝对路径")
    path = fields.CharField(max_length=256, null=True, description="相对路径")
    modify_date = fields.DatetimeField(description="更改时间")
    is_dir = fields.IntField(description="是否是文件夹")
    type = fields.CharField(max_length=64, description="类型")
    type_id = fields.IntField(description="类型标识")

    class Meta:
        table = "tbl_file"


class LibraryList(Model):
    """
    Library list model
    """

    id = fields.IntField(pk=True, description="文库标识")
    specimen_parent_id = fields.CharField(max_length=64, description="父类样品标识")
    specimen_id = fields.CharField(max_length=64, description="样品标识")
    sample_name = fields.CharField(max_length=64, description="样品名称")
    library_name = fields.CharField(max_length=64, description="文库名称")
    library_concentration = fields.FloatField(description="文库浓度")

    class Meta:
        table = "tbl_library_list"


class LogOperation(Model):
    """
    Log opration model
    """

    id = fields.IntField(pk=True, description="标识")
    log_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="记录时间")
    # operator: fields.ForeignKeyRelation["User"] = \
    #     fields.ForeignKeyField("User", related_name="user_log", description="操作人标识")
    function_name = fields.CharField(max_length=128, description="函数名称")
    function_name_desc = fields.CharField(max_length=128, description="功能描述")
    source_ip = fields.CharField(max_length=32, default="127.0.0.1", description="IP来源")
    res_status = fields.IntField(default=200, description="请求状态")
    res_json = fields.TextField(description="请求JSON数据")
    request_method = fields.CharField(max_length=8, description="请求方式")
    related_test_order_flag = fields.IntField(default=0, description="关联订单标识符")
    test_order_id = fields.IntField(null=True, description="订单标识")

    class Meta:
        table = "tbl_log_operation"


class PPGx(Model):
    """
    Produce PGx model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=64, description="样本编号")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now, description="创建时间")
    library_id = fields.CharField(max_length=32, description="文库编号")
    flowcell_lane = fields.CharField(max_length=32, description="芯片泳道")
    chr = fields.CharField(max_length=200, description="染色体，1~22，x, y")
    start = fields.CharField(max_length=200, description="染色体起始位置")
    end = fields.CharField(max_length=200, description="染色体起始位置")
    genotype = fields.CharField(max_length=200, description="基因型")
    freq = fields.CharField(max_length=200, description="频率")
    gene_symbol = fields.CharField(max_length=32, description="基因标记")
    dbsnp = fields.TextField(description="dbsnp编码")
    depth_total = fields.FloatField(null=True, description="深度-总和")
    depth_ss = fields.FloatField(null=True, description="深度-ss")
    depth_ds = fields.FloatField(null=True, description="深度-ds")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0-原始，1-修改，2-新增")
    qc1_operate_state = fields.IntField(null=True, description="qc1判定状态")
    qc2_operate_state = fields.IntField(null=True, description="qc2判定状态")
    gene_id = fields.IntField(null=True, description="基因")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果（T, F, R, S）")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人-名称")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果（T, F, R, S）")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人-名称")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果（T, F, R, S）")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    var_id = fields.CharField(max_length=64, null=True, description="变异标识")
    final = fields.CharField(max_length=32, null=True, description="审核最终结果")
    sort_code = fields.IntField(null=True, description="排序方式")
    depth_uniq = fields.CharField(max_length=32, description="深度")
    json_batch_name = fields.CharField(max_length=200, description="批次编号")

    class Meta:
        table = "tbl_p_pgx"


class PCategoryDataOnTable(Model):
    """
    Produce category data on table model
    """

    id = fields.IntField(pk=True, description="标识")
    category = fields.CharField(max_length=32, description="种类")
    tablename = fields.CharField(max_length=32, description="表名")
    model_class = fields.CharField(max_length=32, description="表模型类名")
    schema_class = fields.CharField(max_length=32, null=True, description="schema类名")
    color_code = fields.CharField(max_length=32, null=True, description="颜色编码")
    category_sub = fields.CharField(max_length=32, null=True, description="子类型")
    default_column = fields.TextField(null=True, description="默认表结构字段")
    variant_default_column = fields.TextField(null=True, description="变异默认字段")
    sample_type = fields.CharField(max_length=32, null=True, description="dna,rna,other 标识这表存的是哪种类别的数据，由于前期没有统一告诉sample ?id造成的")
    audit_schema_class = fields.CharField(max_length=64, null=True, description="数据审核调用的 schema")
    remark = fields.TextField(null=True, description="备注")

    class Meta:
        table = "tbl_p_category_data_on_table"


class PCategoryType(Model):
    """
    Produce category type model
    """
    DEL = (
        (0, "未废弃"),
        (1, "已废弃")
    )
    STATE = (
        (0, "初始化"),
        (1, "审核1"),
        (2, "审核2"),
        (3, "编辑")
    )
    sq_no = fields.IntField(pk=True, description="序号")
    var_category_id = fields.CharField(max_length=32, description="变异分类标识")
    var_category = fields.CharField(max_length=64, null=True, description="变异分类")
    gene_symbol = fields.CharField(max_length=64, null=True, description="基因标志")
    gene_id = fields.IntField(null=True, description="基因标识")
    var_type = fields.CharField(max_length=32, null=True, description="变异类型")
    var_id = fields.CharField(max_length=32, description="变异标识")
    sample_id = fields.CharField(max_length=64, description="样品标识")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    created_user = fields.CharField(max_length=32, description="创建人")
    var_aa_position = fields.CharField(max_length=32, null=True, description="aa位置")
    var_subgene = fields.CharField(max_length=256, null=True, description="子基因")
    var_gene_domain = fields.CharField(max_length=32, null=True, description="基因域")
    var_cnv_exon = fields.CharField(max_length=32, null=True, description="cnv外显子")
    var_cnv_gene = fields.CharField(max_length=32, null=True, description="cnv基因")
    var_sv_gene_exon = fields.CharField(max_length=32, null=True, description="sv基因外显子")
    var_sv_gene_pair = fields.CharField(max_length=32, null=True, description="sv基因对")
    var_sv_func_gene = fields.CharField(max_length=32, null=True, description="sv功能基因")
    var_gene_function = fields.CharField(max_length=32, null=True, description="基因功能")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")
    role = fields.CharField(max_length=32, description="角色")
    state = fields.IntField(choices=STATE, default=0, description="0,1,2,3表示不同权限修改的状态，0-初始化，1-审核1，2-审核2，3-编辑")
    is_delete = fields.IntField(choices=DEL, default=0, description="是否废弃，0-未废弃，1-废弃")
    delete_time = fields.DatetimeField(null=True, description="逻辑删除时间")

    class Meta:
        table = "tbl_p_category_type"


class PCnv(Model):
    """
    Produce cnv model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=64, description="样本编号")
    library_id = fields.CharField(max_length=32, description="文库编号")
    flowcell_lane = fields.CharField(max_length=32, description="芯片泳道")
    gene_id = fields.IntField(max_length=32, null=True, description="基因ID，NCBI geneid")
    gene_symbol = fields.CharField(max_length=256, description="基因名称")
    cnv_type = fields.CharField(max_length=16, null=True, description="CNV变异类型，dup/del")
    cn_mean = fields.FloatField(description="平均拷贝数")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    var_origin = fields.CharField(max_length=32, description="变异来源")
    cnv_exons = fields.CharField(max_length=16, description="CNV对应的外显子区域")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    qc1_operate_state = fields.IntField(null=True, description="qc1判定状态")
    qc2_operate_state = fields.IntField(null=True, description="qc2判定状态")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0-原始，1-修改，2-新增")
    region_exon = fields.CharField(max_length=256, null=True, description="受影响的外显子区域")
    num_call = fields.CharField(max_length=255, null=True, description="调用编号")
    p_value_adjust = fields.CharField(max_length=255, null=True, description="判断值")
    var_call = fields.CharField(max_length=255, null=True, description="变异调用")
    var_id = fields.CharField(max_length=255, null=True, description="变异标识")
    var_category_names = fields.CharField(max_length=200, null=True, description="变异分类名称集合")
    var_category_ids = fields.CharField(max_length=200, null=True, description="变异分类标识集合")
    is_remove = fields.IntField(default=0, description="是否不加入报告中，默认false，不去掉，true则去掉，不加入报告")
    is_matched = fields.IntField(default=0, description="是否匹配到知识库，默认false，没有匹配，true则去掉，已经匹配")
    final = fields.CharField(max_length=32, null=True, description="审核最终结果")
    igvplot = fields.CharField(max_length=256, null=True, description="igv截图的相对路径")
    sort_code = fields.IntField(null=True, description="排序编码")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")
    amp_ratio = fields.FloatField(max_length=5, null=True, description="amp比率")
    z_score = fields.FloatField(max_length=5, null=True, description="标准分数")

    class Meta:
        table = "tbl_p_cnv"


class PDictAuditResult(Model):
    """
    Produce dict aduit result model
    """

    id = fields.IntField(pk=True, description="标识")
    code = fields.CharField(max_length=32, description="编码")
    value = fields.CharField(max_length=32, description="编码值")

    class Meta:
        table = "tbl_p_dict_audit_result"


class PDictPlatf(Model):
    """
    dict platform model
    """

    id = fields.IntField(pk=True, description="标识")
    type = fields.CharField(max_length=256, description="类型")
    code = fields.CharField(max_length=256, description="编码")
    create_uid = fields.IntField(description="创建用户标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="写入时间")
    write_uid = fields.IntField(null=True, description="写入用户标识")
    parent: fields.ForeignKeyNullableRelation["PDictPlatf"] = \
        fields.ForeignKeyField("models.PDictPlatf", related_name="parent_plat")

    audit_platform: fields.ReverseRelation["AuditCheck"]
    parent_plat: fields.ReverseRelation["PDictPlatf"]

    class Meta:
        table = "tbl_p_dict_platform"


class PEviSearchAuditdescription(Model):
    """
    Produce evi search audit description model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=64, description="样本编号")
    tumor_id = fields.CharField(max_length=32, description="癌种id")
    tumor_name_en = fields.CharField(max_length=256, description="癌种英文名称")
    tumor_name_cn = fields.CharField(max_length=256, description="癌种中文名称")
    evi_sample_var = fields.CharField(max_length=128, description="变异")
    regimen_id = fields.CharField(max_length=100, null=True, description="治疗方案id")
    evi = fields.CharField(max_length=128, null=True, description="证据, 数组对象格式存入，默认空数组")
    state = fields.IntField(default=0, description="流程等级")
    conclusion = fields.CharField(max_length=100, null=True, description="证据等级_临床意义")
    source = fields.CharField(max_length=32, null=True, description="来源")
    username = fields.CharField(max_length=128, description="生成者名称")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    role = fields.CharField(max_length=32, description="操作者身份")
    evi_modify = fields.CharField(max_length=128, null=True, description="证据更新")
    conclusion_modify = fields.CharField(max_length=100, null=True, description="证据等级_临床意义_new")
    modify_user = fields.CharField(max_length=32, null=True, description="操作者名字")
    modify_time = fields.DatetimeField(null=True, description="操作时间")
    is_deleted = fields.IntField(default=0, description="逻辑删除")
    deleted_time = fields.DatetimeField(null=True, description="逻辑删除时间")
    evi_sample_var_name = fields.CharField(max_length=100, null=True, description="变异名称")
    regimen_name_cn = fields.CharField(max_length=100, null=True, description="治疗方案中文")
    regimen_name_en = fields.CharField(max_length=100, null=True, description="治疗方案英文")

    class Meta:
        table = "tbl_p_evi_search_audit_description"


class PGeneralFilePath(Model):
    """
    Produce general file path model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    sample_id = fields.CharField(max_length=256, description="样本标识")
    produce_id = fields.CharField(max_length=256, description="产品标识")
    abs_path = fields.CharField(max_length=256, description="绝对路径")
    relative_path = fields.CharField(max_length=256, description="相对路径")
    file_name = fields.CharField(max_length=256, description="文件名")
    type = fields.CharField(max_length=48, description="类型")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    create_uid = fields.IntField(null=True, description="创建人")
    write_uid = fields.IntField(null=True, description="更新人")
    subtype = fields.CharField(max_length=48, null=True, description="子类型")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_general_file_path"


class PHrd(Model):
    """
    Produce hrd model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=256, index=True, description="样品标识")
    library_id = fields.CharField(max_length=32, description="文库标识")
    flowcell_lane = fields.CharField(max_length=32, description="芯片泳道")
    loh_score = fields.IntField(description="loh分值")
    tai_score = fields.IntField(description="tai分值")
    hrd_score = fields.IntField(description="hrd分值")
    lst_score = fields.IntField(description="lst分值")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    qc1_operate_state = fields.IntField(null=True, description="qc1判定状态")
    qc2_operate_state = fields.IntField(null=True, description="qc2判定状态")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da1_time = fields.DatetimeField(null=True, description="初审判定时间")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    var_da2_time = fields.DatetimeField(null=True, description="复审判定时间")
    bioinfo_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    gview_file_path = fields.CharField(max_length=150, null=True, description="HRD_genome_view图的相对存储路径")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_hrd"


class PLibPrep(Model):
    """
    Produce lib prep model
    """

    id = fields.IntField(pk=True, description="标识")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    library_no = fields.CharField(max_length=256, description="文库编号")
    sample_na_id = fields.CharField(max_length=256, description="钠样品标识")
    na_concn = fields.FloatField(description="钠浓度")
    libprep_na_qt = fields.FloatField(description="文库预备-钠取用量")
    libprep_na_vol = fields.FloatField(description="文库预备-钠体积")
    libprep_h2o_vol = fields.FloatField(description="文库预备-水体积")
    library_adaptor = fields.FloatField(description="接头")
    library_id = fields.CharField(max_length=32, description="文库标识")
    udi_primer = fields.CharField(max_length=256, description="udi引物")
    i7_index = fields.CharField(max_length=256, description="i7坐标")
    i5_index = fields.CharField(max_length=256, description="i5坐标")
    library_concn = fields.FloatField(description="文库浓度")
    break_na_vol = fields.FloatField(null=True, description="钠取用体积断点")
    break_h2o_vol = fields.FloatField(null=True, description="水取用体积断点")
    na_postbreak_concn = fields.FloatField(null=True, description="钠处理后浓度")
    qc_result = fields.CharField(max_length=256, null=True, description="qc结果")
    libprep_operator = fields.CharField(max_length=256, description="文库预备-操作人")
    libprep_date = fields.DateField(max_length=256, null=True, description="文库预备日期")
    auditor = fields.CharField(max_length=256, null=True, description="审核人")
    audit_date = fields.DatetimeField(max_length=256, null=True, description="审核时间")
    libprep_method = fields.CharField(max_length=256, description="文库预备-方法")
    modify_date = fields.DatetimeField(max_length=32, null=True, description="更新时间")
    status = fields.IntField(default=1, description="-1,标识是旧数据，字段名称是根据其它表设置")
    note = fields.TextField(null=True, description="备注")

    class Meta:
        table = "tbl_p_lib_prep"


class PLibPrepDNA(Model):
    """
    Produce lib prep DNA model
    """

    id = fields.IntField(pk=True, description="标识")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    library_no = fields.CharField(max_length=32, description="文库编号")
    sample_dna_id = fields.CharField(max_length=32, description="DNA样品编号")
    dna_concn = fields.FloatField(description="DNA浓度")
    break_dna_vol = fields.FloatField(description="DNA样品打断取用体积")
    break_h2o_vol = fields.FloatField(description="水打断取用体积")
    dna_postbreak_concn = fields.FloatField(description="DNA处理后浓度")
    libprep_dna_qt = fields.FloatField(description="DNA样品建库取用量")
    libprep_dna_vol = fields.FloatField(description="DNA样品建库取用体积")
    libprep_h2o_vol = fields.FloatField(description="补水体积")
    library_adaptor = fields.FloatField(description="接头")
    library_id = fields.CharField(max_length=32, description="文库标识")
    udi_primer = fields.CharField(max_length=32, description="udi引物")
    i7_index = fields.CharField(max_length=32, description="i7坐标")
    i5_index = fields.CharField(max_length=32, description="i5坐标")
    library_operator = fields.CharField(max_length=32, description="建库人")
    libprep_date = fields.DateField(null=True, description="建库日期")
    auditor = fields.CharField(max_length=32, description="审核人")
    audit_date = fields.DatetimeField(null=True, description="审核日期")
    libprep_method = fields.CharField(max_length=32, description="建库方法")
    library_concn = fields.FloatField(description="文库浓度")
    library_qc_result = fields.CharField(max_length=10, null=True, description="")
    note = fields.TextField(null=True, description="备注")
    modify_date = fields.DatetimeField(null=True, description="更新时间")
    status = fields.IntField(default=1, description="-1,标识是旧数据，字段名称是根据其它表设置")
    quantity = fields.FloatField(null=True, description="数量")
    dna_din = fields.FloatField(null=True, description="DNA完整值")
    dna_qty = fields.FloatField(null=True, description="Total input")
    library_qty = fields.FloatField(null=True, description="post PCR")

    class Meta:
        table = "tbl_p_lib_prep_dna"


class PLibPrepRNA(Model):
    """
    Produce lib prep RNA model
    """

    id = fields.IntField(pk=True, description="标识")
    library_no = fields.CharField(max_length=32, description="文库序号")
    sample_rna_id = fields.CharField(max_length=32, description="RNA样品标识")
    rna_concn = fields.FloatField(description="RNA浓度")
    dv200 = fields.FloatField(description="DV200")
    break_rna_vol = fields.FloatField(description="RNA打断取用体积")
    break_h2o_vol = fields.FloatField(description="打断补水体积")
    break_time = fields.CharField(max_length=32, description="打断时间，minutes or ℃ + minutes")
    cdna_concn = fields.FloatField(description="cDNA浓度")
    cdna_vol = fields.FloatField(description="cDNA投入体积")
    libprep_cdna_qt = fields.FloatField(description="cDNA建库投入量")
    library_adaptor_vol = fields.FloatField(description="接头")
    libprep_h2o_vol = fields.FloatField(description="建库补水体积")
    library_id = fields.CharField(max_length=32, description="文库标识")
    udi_primer = fields.CharField(max_length=32, description="UDI引物")
    library_concn = fields.FloatField(description="文库浓度")
    library_qc_result = fields.CharField(max_length=32, null=True, description="文库QC结果，合格 or 不合格")
    note = fields.TextField(null=True, description="备注")
    library_operator = fields.CharField(max_length=32, null=True, description="文库操作员")
    libprep_date = fields.DateField(null=True, description="建库日期")
    i7_index = fields.CharField(max_length=32, description="i7坐标")
    i5_index = fields.CharField(max_length=32, description="i5坐标")
    libprep_method = fields.CharField(max_length=32, null=True, description="建库方法，打断 or 非打断")
    auditor = fields.CharField(max_length=32, null=True, description="审核员")
    audit_date = fields.DatetimeField(null=True, description="审核时间")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    modify_date = fields.DatetimeField(null=True, description="更新时间")
    status = fields.IntField(default=1, description="-1,标识是旧数据，字段名称是根据其它表设置")
    quantity = fields.FloatField(description="数量")
    rna_rin = fields.FloatField(description="RNA值")
    library_qty = fields.FloatField(description="post PCR")
    rna_qty = fields.FloatField(description="Total input")
    libprep_cdna_qty = fields.FloatField(description="cDNA建库取用量")

    class Meta:
        table = "tbl_p_lib_prep_rna"


class PMlpa(Model):
    """
    Produce mlpa model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    gene_id = fields.IntField(null=True, description="基因标识")
    gene_symbol = fields.CharField(max_length=64, description="基因标志")
    value = fields.CharField(max_length=32, description="外显子")
    type = fields.CharField(max_length=32, description="突变类型")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    modify_date = fields.DatetimeField(null=True, description="更新时间")
    status = fields.IntField(default=1, description="-1,标识是旧数据，字段名称是根据其它表设置")
    final_ratio = fields.FloatField(description="最终比率")
    qc1_operate_state = fields.IntField(default=0, description="QC1判断状态")
    qc2_operate_state = fields.IntField(default=0, description="QC2判定状态")
    refpop = fields.CharField(max_length=64, null=True, description="ref pop")
    sampop = fields.CharField(max_length=64, null=True, description="sam pop")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果，判定结果T/F")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果，判定结果T/F")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    version = fields.CharField(max_length=32, null=True, description="时间版本号")

    class Meta:
        table = "tbl_p_mlpa"


class PMlpaImage(Model):
    """
    Produce mlpa image model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, description="样品标识")
    output_date = fields.CharField(max_length=20, description="输出日期")
    file_path = fields.CharField(max_length=256, description="文件路径")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    modify_date = fields.DatetimeField(null=True, description="更新时间")
    status = fields.IntField(default=1, description="-1,标识是旧数据，字段名称是根据其它表设置")
    version = fields.CharField(max_length=32, null=True, description="时间版本号")

    class Meta:
        table = "tbl_p_mlpa_image"


class PMsi(Model):
    """
    Produce msi model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=64, description="样本编号")
    library_id = fields.CharField(max_length=32, description="文库编号")
    flowcell_lane = fields.CharField(max_length=32, description="芯片泳道")
    msi_score = fields.FloatField(default=0, description="MSI分值")
    msi_result = fields.CharField(max_length=10, default="MSS", description="MSI結果")
    bioinfo_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    qc1_operate_state = fields.IntField(default=0, escription="qc1判定結果")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定結果")
    msi_num = fields.CharField(max_length=32, null=True, description="MSI编号")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    var_id = fields.CharField(max_length=32, null=True, description="变异标识")
    img_filename = fields.CharField(max_length=128, description="图片名称")
    img_path = fields.CharField(max_length=200, description="图片路径")
    final = fields.CharField(max_length=10, null=True, description="审核最终结果")
    sort_code = fields.IntField(null=True, description="排序编码")
    msi_detail = fields.CharField(max_length=64, null=True, description="MSI位点数")
    msiplot = fields.CharField(max_length=200, null=True, description="MSI绘图点")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_msi"


class PPathologyQualityControl(Model):
    """
    Produce pathology quality control model
    """
    DEL = (
        (0, "未废弃"),
        (1, "已废弃")
    )
    id = fields.IntField(pk=True, description="标识")
    sample_id = fields.CharField(max_length=64, description="样品流水号")
    receipt_date = fields.DatetimeField(description="样本交接到病理环节的时间")
    prod_names = fields.CharField(max_length=64, description="检测项目（不同的NGS检测项目对组织样本中肿瘤细胞比例的及格标准不一样）")
    is_retest = fields.CharField(max_length=8, default="N", description="第二次送样、补寄样本、深切等情形")
    retest_reason = fields.CharField(max_length=200, null=True, description="重复检测原因")
    patho_diagn = fields.CharField(max_length=200, description="病理诊断结果")
    patho_diagn_suppl = fields.CharField(max_length=200, null=True, description="病理诊断补充说明")
    tc_pct = fields.CharField(max_length=8, description="肿瘤细胞占比（tumor cell percentage）")
    tc_qc_suppl = fields.CharField(max_length=200, description="肿瘤细胞占比质控补充说明")
    qc_result_ngs = fields.IntField(default=1, description="肿瘤细胞占比是否满足NGS的质控要求（不同的NGS检测项目对组织样本中肿瘤细胞占比的要求不一样）")
    qc_result_ihc = fields.IntField(default=1, description="肿瘤细胞占比是否满足IHC的质控要求")
    patho_dr = fields.CharField(max_length=64, description="做出本次病理质控判定的病理医生")
    sign_date = fields.DatetimeField(null=True, description="病理医生签字时间")
    next_process = fields.IntField(default=0, description="是否用于实验")
    create_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    create_uid = fields.IntField(description="创建人id")
    write_uid = fields.IntField(null=True, description="修改人id")
    is_delete = fields.IntField(choices=DEL, default=0, description="是否废弃，0-未废弃，1-废弃")
    rf_file_id = fields.IntField(description="上传文件的文件保存id")
    rf_file_name = fields.CharField(max_length=200, description="数据所属文件名")

    class Meta:
        table = "tbl_p_pathology_quality_control"


class PPdl1(Model):
    """
    Produce pdl1 model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, index=True, description="样品编号")
    result = fields.CharField(max_length=200, description="阴性/阳性")
    value = fields.FloatField(description="百分比")
    type = fields.CharField(max_length=256, description="类型 TPS、CPS")
    file_nc = fields.CharField(max_length=256, description="NC文件名")
    file_pdl1 = fields.CharField(max_length=256, description="PDL1文件名")
    file_he = fields.CharField(max_length=256, description="HE文件名")
    file_pc = fields.CharField(max_length=256, description="PC文件名")
    output_date = fields.CharField(max_length=20, description="输出日期")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    modify_date = fields.DatetimeField(null=True, description="更新时间")
    status = fields.IntField(default=1, description="-1,标识是旧数据，字段名称是根据其它表设置")

    class Meta:
        table = "tbl_p_pdl1"


class PPlatfMsi(Model):
    """
    Produce platf msi model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, description="样品标识")
    sanger_msi_result = fields.CharField(max_length=32, default="MSI-H", description="Sanger MSI结果")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    modify_date = fields.DatetimeField(null=True, description="更新时间")
    status = fields.IntField(default=1, description="-1,标识是旧数据，字段名称是根据其它表设置")

    class Meta:
        table = "tbl_p_platf_msi"


class PQcGradient(Model):
    """
    Produce qc gradient model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=64, description="样本编号")
    gradient_num = fields.IntField(max_length=32, description="梯度号")
    gradient_ratio = fields.FloatField(max_length=16, description="梯度比率")
    qc_source = fields.CharField(max_length=32, default="coverage_ratio_uniq", description="来源")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_qc_gradient"


class PSampleVarCategory(Model):
    """
    Produce sample var category model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    create_uid = fields.IntField(description="创建人标识")
    sample_id = fields.CharField(max_length=64, description="样本编号")
    is_change = fields.IntField(default=0, description="变异分类是否修改，用于触发脚本, 0-未修改，1-已修改")
    is_change_tumor = fields.IntField(null=True, description="癌症是否修改，用于触发脚本")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    write_uid = fields.IntField(null=True, description="更新人标识")

    class Meta:
        table = "tbl_p_sample_var_category"


class PSeqDataQc(Model):
    """
    Produce seq data qc model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, index=True, description="样本编号")
    library_id = fields.CharField(max_length=32, description="文库编号")
    flowcell_lane = fields.CharField(max_length=32, description="芯片泳道")
    match_ratio = fields.FloatField(max_length=20, description="匹配比率")
    bardist = fields.CharField(max_length=32, description="比值数据")
    residual_r1 = fields.FloatField(max_length=5, description="r1残留量")
    residual_r2 = fields.FloatField(max_length=5, description="r2残留量")
    cleandata_size = fields.CharField(max_length=15, description="清洗数据大小")
    cleandata_gc_ratio = fields.FloatField(description="清洗数据gc比率")
    cleandata_q20 = fields.FloatField(description="清洗数据-q20")
    cleandata_q30 = fields.FloatField(description="清洗数据-q30")
    mapping_ratio = fields.FloatField(description="映射比率")
    nonprope_ratio = fields.FloatField(description="非方案比率")
    lqreads_ratio = fields.FloatField(description="lq读长比率")
    hqreads_ratio = fields.FloatField(description="hq读长比率")
    read_ontarget_ratio = fields.FloatField(description="准确的读长比率")
    base_ontarget_ratio = fields.FloatField(description="准确的基础比率")
    gc_ontarget_ratio = fields.FloatField(description="准确的gc比率")
    gc_offtarget_ratio = fields.FloatField(description="不准确的gc比率")
    inssize_ontarget = fields.FloatField(description="原表字段ID, 该变异在原知识库版本中的变异id编号")
    inssize_offtarget = fields.FloatField(description="胚系变异ACMG规则判定，原字段rating")
    dup_ratio = fields.FloatField(description="变异分类等级结果，值来自知识库，原字段Signification, Determine")
    cover_ratio = fields.FloatField(description="参考信息来源，值来自知识库，包括PMID， URL，DOI等")
    depth_mean = fields.FloatField(description="深度拷贝数")
    depth_ssbc = fields.FloatField(description="深度ssbc")
    depth_dsbc = fields.FloatField(description="深度dsbc")
    uni20 = fields.FloatField(description="uni20")
    uni20_ssbc = fields.FloatField(description="uni20 ssbc")
    uni20_dsbc = fields.FloatField(description="uni20 dsbc")
    uni50 = fields.FloatField(description="uni50")
    uni50_ssbc = fields.FloatField(description="uni50 ssbc")
    uni50_dsbc = fields.FloatField(description="uni50 dsbc")
    bioinfo_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    created_time = fields.DatetimeField(description="入时间，系统自动生成，now(description="")获取")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0-原始，1-修改，2-新增")
    reads_counts = fields.IntField(null=True, description="读长数量")
    control_counts = fields.IntField(null=True, description="控制数量")
    crossmatch_ratio = fields.FloatField(null=True, description="交叉匹配比")
    depth_CV = fields.FloatField(null=True, description="CV深度")
    depth_max = fields.FloatField(null=True, description="最大深度")
    depth_mean_rna = fields.FloatField(null=True, description="RNA深度拷贝数")
    depth_min = fields.FloatField(null=True, description="最小深度")
    judgment_ratio = fields.FloatField(null=True, description="判定比率")
    unassemble_ratio = fields.FloatField(null=True, description="未处理比率")
    unmatch_ratio = fields.FloatField(null=True, description="未匹配比率")
    var_audit_auto = fields.CharField(max_length=10, null=True, description="自动审核")
    var_id = fields.CharField(max_length=32, null=True, description="")
    depth_hotregion_mean = fields.FloatField(null=True, description="热区域深度拷贝数")
    depth_nonhotregion_mean = fields.FloatField(null=True, description="非热区域深度拷贝数")
    qc_type = fields.CharField(max_length=32, null=True, description="数据质控区分")
    depth_hotregion_ssbc = fields.FloatField(null=True, description="热区域深度ssbc")
    depth_rna_ctrl = fields.IntField(null=True, description="RNA深度控制")
    data_auto_result = fields.CharField(max_length=32, null=True, description="数据质控自动分析结果")
    data_da1_operator = fields.CharField(max_length=32, null=True, description="数据质控初审人")
    data_da1_result = fields.CharField(max_length=32, null=True, description="数据质控初审人判定结果")
    data_da1_time = fields.DatetimeField(null=True, description="数据质控初审人操作时间")
    data_da2_operator = fields.CharField(max_length=32, null=True, description="数据质控复审人")
    data_da2_result = fields.CharField(max_length=32, null=True, description="数据质控复审人判定结果")
    data_da2_time = fields.DatetimeField(null=True, description="数据质控复审人操作时间")
    final = fields.CharField(max_length=32, null=True, description="审核最终结果")
    sort_code = fields.IntField(null=True, description="排序编码")
    mtxplot = fields.CharField(max_length=256, null=True, description="流程污染矩阵图的相对路径")
    depth_median = fields.FloatField(max_length=12, null=True, description="深度中位数")
    depth_median_dsbc = fields.FloatField(max_length=12, null=True, description="深度中位数dsbc")
    depth_median_ssbc = fields.FloatField(max_length=12, null=True, description="深度中位数ssbc")
    alignedreads = fields.IntField(null=True, description="对齐读长")
    cellularity = fields.FloatField(max_length=6, dnull=True, escription="程序估算的肿瘤细胞含量")
    depth_hotregion_dsbc = fields.FloatField(max_length=12, null=True, description="热区域深度dsbc")
    depth_hotregion_uni20 = fields.FloatField(max_length=12, null=True, description="热区域深度uni20")
    depth_hotregion_uni50 = fields.FloatField(max_length=12, null=True, description="热区域深度uni50")
    depth_mean_dsbc = fields.FloatField(max_length=12, null=True, description="深度拷贝数dsbc")
    depth_mean_dsbc_hot = fields.FloatField(max_length=12, null=True, description="热深度拷贝数dsbc")
    depth_mean_dsbc_nonhot = fields.FloatField(max_length=12, null=True, description="非热深度拷贝数dsbc")
    depth_mean_ssbc = fields.FloatField(max_length=12, null=True, description="深度拷贝数ssbc")
    depth_mean_ssbc_hot = fields.FloatField(max_length=12, null=True, description="热深度拷贝数ssbc")
    depth_mean_ssbc_nonhot = fields.FloatField(max_length=12, null=True, description="非热深度拷贝数ssbc")
    depth_mean_uniq = fields.FloatField(max_length=12, null=True, description="深度拷贝数uniq")
    depth_mean_uniq_hot = fields.FloatField(max_length=12, null=True, description="深度拷贝数uniq-hot")
    depth_mean_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="深度拷贝数uniq-non hot")
    depth_median_dsbc_hot = fields.FloatField(max_length=12, null=True, description="深度中位数dsbc-hot")
    depth_median_dsbc_nonhot = fields.FloatField(max_length=12, null=True, description="深度中位数dsbc-non hot")
    depth_median_ssbc_hot = fields.FloatField(max_length=12, null=True, description="深度中位数ssbc-hot")
    depth_median_ssbc_nonhot = fields.FloatField(max_length=12, null=True, description="深度中位数ssbc-non hot")
    depth_median_uniq = fields.FloatField(max_length=12, null=True, description="深度中位数uniq")
    depth_median_uniq_hot = fields.FloatField(max_length=12, null=True, description="深度中位数uniq-hot")
    depth_median_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="深度中位数uniq-non hot")
    depth_nonhotregion_dsbc = fields.FloatField(max_length=12, null=True, description="非热区域深度dsbc")
    depth_nonhotregion_ssbc = fields.FloatField(max_length=12, null=True, description="非热区域深度ssbc")
    depth_nonhotregion_uni20 = fields.FloatField(max_length=12, null=True, description="非热区域深度uni20")
    depth_nonhotregion_uni50 = fields.FloatField(max_length=12, null=True, description="非热区域深度uni50")
    hotdepth_median_dsbc = fields.FloatField(max_length=12, null=True, description="hot-深度中位数dsbc")
    hotdepth_median_ssbc = fields.FloatField(max_length=12, null=True, description="hot-深度中位数ssbc")
    hotdepth_median_uniq = fields.FloatField(max_length=12, null=True, description="hot-深度中位数uniq")
    nonhotdepth_median_dsbc = fields.FloatField(max_length=12, null=True, description="non hot-深度中位数dsbc")
    nonhotdepth_median_ssbc = fields.FloatField(max_length=12, null=True, description="non hot-深度中位数ssbc")
    nonhotdepth_median_uniq = fields.FloatField(max_length=12, null=True, description="non hot-深度中位数uniq")
    ploidy = fields.FloatField(max_length=6, null=True, description="染色体倍型")
    totaldata = fields.CharField(max_length=10, null=True, description="数据总量")
    totalreads = fields.IntField(null=True, description="读长总量")
    uni20_uniq = fields.FloatField(max_length=12, null=True, description="uni20 uniq")
    uni20_uniq_hot = fields.FloatField(max_length=12, null=True, description="uni20 uniq hot")
    uni20_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="uni20 uniq non hot")
    uni50_uniq = fields.FloatField(max_length=12, null=True, description="uni50 uniq")
    uni50_uniq_hot = fields.FloatField(max_length=12, null=True, description="uni50 uniq hot")
    uni50_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="uni50 uniq non hot")
    coverage_ratio_dsbc = fields.FloatField(max_length=12, null=True, description="dsbc平均比率")
    coverage_ratio_dsbc_hot = fields.FloatField(max_length=12, null=True, description="hot dsbc平均比率")
    coverage_ratio_ssbc = fields.FloatField(max_length=12, null=True, description="ssbc平均比率")
    coverage_ratio_ssbc_hot = fields.FloatField(max_length=12, null=True, description="hot ssbc平均比率")
    coverage_ratio_uniq = fields.FloatField(max_length=12, null=True, description="uniq平均比率")
    coverage_ratio_uniq_hot = fields.FloatField(max_length=12, null=True, description="hot uniq平均比率")
    depth_dsbc_hot = fields.FloatField(max_length=12, null=True, description="深度dsbc-hot")
    depth_mean_hot = fields.FloatField(max_length=12, null=True, description="深度拷贝数-hot")
    depth_ssbc_hot = fields.FloatField(max_length=12, null=True, description="深度ssbc-hot")
    cnv_cv = fields.FloatField(max_length=5, null=True, description="cnv cv")
    cnv_uni = fields.FloatField(max_length=5, null=True, description="cnv uni")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_seq_data_qc"


class PSeqGepCutoff(Model):
    """
    Produce seq gep cutoff model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    gep_ver = fields.CharField(max_length=32, description="胃肠胰ver")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    creator = fields.CharField(max_length=32, description="")
    gep_cutoff = fields.FloatField(description="胃肠胰切割点")
    note = fields.TextField(null=True, description="备注")
    tumor_id = fields.IntField(description="")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_seq_gep_cutoff"


class PSeqGepImage(Model):
    """
    Produce gep image model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    file_path = fields.CharField(max_length=200, description="文件路径")
    image_name = fields.CharField(max_length=200, description="图片名称")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_seq_gep_image"


class PSeqGepScore(Model):
    """
    Produce seq gep score model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    var_id = fields.CharField(max_length=256, null=True, description="")
    gep_score = fields.FloatField(description="gep分值")
    gep_model = fields.CharField(max_length=32, description="gep模型")
    gep_ver = fields.CharField(max_length=256, description="gep版本")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    batch = fields.CharField(max_length=256, null=True, description="批次")
    is_show = fields.IntField(default=0, description="是否展示，0-不展示，1-展示")
    img_filename = fields.CharField(max_length=100, null=True, description="图片名称")
    img_path = fields.CharField(max_length=200, null=True, description="图片路径")
    final = fields.CharField(max_length=32, null=True, description="审核最终结果")
    sort_code = fields.IntField(null=True, description="排序编码")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_seq_gep_score"


class PSeqHlaTyping(Model):
    """
    Produce seq HLA typing model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    library_id = fields.CharField(max_length=32, description="文库标识")
    flowcell_lane = fields.CharField(max_length=128, description="芯片泳道")
    hla_gene = fields.CharField(max_length=32, description="HLA基因")
    specific_hla_protein = fields.CharField(max_length=20, description="具体HLA蛋白")
    allele_group = fields.CharField(max_length=20, description="等位基因组标识")
    batch = fields.CharField(max_length=256, null=True, description="批次")
    is_show = fields.IntField(default=0, description="是否展示，0-不展示，1-展示")
    final = fields.CharField(max_length=32, description="审核最终结果")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    var_id = fields.CharField(max_length=32, null=True, description="变异标识")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    sort_code = fields.IntField(null=True, description="排序编码")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_seq_hla_typing"


class PSeqRnaDataQc(Model):
    """
    Produce seq RNA data qc model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    library_id = fields.CharField(max_length=32, description="文库标识")
    created_time = fields.DatetimeField(description="入时间，系统自动生成，now(description="")获取")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    var_id = fields.CharField(max_length=32, null=True, description="变异标识")
    flowcell_lane = fields.CharField(max_length=256, description="芯片泳道")
    match_ratio = fields.CharField(max_length=256, description="匹配比率")
    bardist = fields.CharField(max_length=32, description="比值数据")
    residual_r1 = fields.FloatField(max_length=5, description="r1残留量")
    residual_r2 = fields.FloatField(max_length=5, description="r2残留量")
    cleandata_size = fields.CharField(max_length=15, description="清洗数据大小")
    cleandata_gc_ratio = fields.FloatField(description="清洗数据gc比率")
    cleandata_q20 = fields.FloatField(description="清洗数据-q20")
    cleandata_q30 = fields.FloatField(description="清洗数据-q30")
    mapping_ratio = fields.FloatField(description="映射比率")
    read_ontarget_ratio = fields.FloatField(description="准确的读长比率")
    base_ontarget_ratio = fields.FloatField(description="准确的基础比率")
    inssize_ontarget = fields.FloatField(description="原表字段ID, 该变异在原知识库版本中的变异id编号")
    dup_ratio = fields.FloatField(description="变异分类等级结果，值来自知识库，原字段Signification, Determine")
    end2sense_ratio = fields.FloatField(description="端到感比率")
    uni_entropy = fields.FloatField(description="uni熵")
    gene_qty = fields.FloatField(description="基因取用量")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    batch = fields.CharField(max_length=256, null=True, description="批次")
    is_show = fields.IntField(default=0, description="是否展示，0-不展示，1-展示")
    data_auto_result = fields.CharField(max_length=32, null=True, description="数据质控自动分析结果")
    data_da1_operator = fields.CharField(max_length=32, null=True, description="数据质控初审人")
    data_da1_result = fields.CharField(max_length=32, null=True, description="数据质控初审人判定结果")
    data_da1_time = fields.DatetimeField(null=True, description="数据质控初审人操作时间")
    data_da2_operator = fields.CharField(max_length=32, null=True, description="数据质控复审人")
    data_da2_result = fields.CharField(max_length=32, null=True, description="数据质控复审人判定结果")
    data_da2_time = fields.DatetimeField(null=True, description="数据质控复审人操作时间")
    final = fields.CharField(max_length=32, null=True, description="审核最终结果")
    sort_code = fields.IntField(null=True, description="排序编码")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    depth_hotregion_mean = fields.FloatField(null=True, description="热区域深度拷贝数")
    depth_nonhotregion_mean = fields.FloatField(null=True, description="非热区域深度拷贝数")
    depth_median = fields.FloatField(max_length=12, null=True, description="深度中位数")
    depth_median_dsbc = fields.FloatField(max_length=12, null=True, description="深度中位数dsbc")
    depth_median_ssbc = fields.FloatField(max_length=12, null=True, description="深度中位数ssbc")
    depth_hotregion_dsbc = fields.FloatField(max_length=12, null=True, description="热区域深度dsbc")
    depth_hotregion_uni20 = fields.FloatField(max_length=12, null=True, description="热区域深度uni20")
    depth_hotregion_uni50 = fields.FloatField(max_length=12, null=True, description="热区域深度uni50")
    depth_mean_dsbc = fields.FloatField(max_length=12, null=True, description="深度拷贝数dsbc")
    depth_mean_dsbc_hot = fields.FloatField(max_length=12, null=True, description="热深度拷贝数dsbc")
    depth_mean_dsbc_nonhot = fields.FloatField(max_length=12, null=True, description="非热深度拷贝数dsbc")
    depth_mean_ssbc = fields.FloatField(max_length=12, null=True, description="深度拷贝数ssbc")
    depth_mean_ssbc_hot = fields.FloatField(max_length=12, null=True, description="热深度拷贝数ssbc")
    depth_mean_ssbc_nonhot = fields.FloatField(max_length=12, null=True, description="非热深度拷贝数ssbc")
    depth_mean_uniq = fields.FloatField(max_length=12, null=True, description="深度拷贝数uniq")
    depth_mean_uniq_hot = fields.FloatField(max_length=12, null=True, description="深度拷贝数uniq-hot")
    depth_mean_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="深度拷贝数uniq-non hot")
    depth_median_dsbc_hot = fields.FloatField(max_length=12, null=True, description="深度中位数dsbc-hot")
    depth_median_dsbc_nonhot = fields.FloatField(max_length=12, null=True, description="深度中位数dsbc-non hot")
    depth_median_ssbc_hot = fields.FloatField(max_length=12, null=True, description="深度中位数ssbc-hot")
    depth_median_ssbc_nonhot = fields.FloatField(max_length=12, null=True, description="深度中位数ssbc-non hot")
    depth_median_uniq = fields.FloatField(max_length=12, null=True, description="深度中位数uniq")
    depth_median_uniq_hot = fields.FloatField(max_length=12, null=True, description="深度中位数uniq-hot")
    depth_median_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="深度中位数uniq-non hot")
    depth_nonhotregion_dsbc = fields.FloatField(max_length=12, null=True, description="非热区域深度dsbc")
    depth_nonhotregion_ssbc = fields.FloatField(max_length=12, null=True, description="非热区域深度ssbc")
    depth_nonhotregion_uni20 = fields.FloatField(max_length=12, null=True, description="非热区域深度uni20")
    depth_nonhotregion_uni50 = fields.FloatField(max_length=12, null=True, description="非热区域深度uni50")
    hotdepth_median_dsbc = fields.FloatField(max_length=12, null=True, description="hot-深度中位数dsbc")
    hotdepth_median_ssbc = fields.FloatField(max_length=12, null=True, description="hot-深度中位数ssbc")
    hotdepth_median_uniq = fields.FloatField(max_length=12, null=True, description="hot-深度中位数uniq")
    nonhotdepth_median_dsbc = fields.FloatField(max_length=12, null=True, description="non hot-深度中位数dsbc")
    nonhotdepth_median_ssbc = fields.FloatField(max_length=12, null=True, description="non hot-深度中位数ssbc")
    nonhotdepth_median_uniq = fields.FloatField(max_length=12, null=True, description="non hot-深度中位数uniq")
    uni20_uniq = fields.FloatField(max_length=12, null=True, description="uni20 uniq")
    uni20_uniq_hot = fields.FloatField(max_length=12, null=True, description="uni20 uniq hot")
    uni20_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="uni20 uniq non hot")
    uni50_uniq = fields.FloatField(max_length=12, null=True, description="uni50 uniq")
    uni50_uniq_hot = fields.FloatField(max_length=12, null=True, description="uni50 uniq hot")
    uni50_uniq_nonhot = fields.FloatField(max_length=12, null=True, description="uni50 uniq non hot")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_seq_rna_data_qc"


class PSeqRnaExp(Model):
    """
    Produce seq RNA exp model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    gene_symbol = fields.CharField(max_length=64, description="基因标志")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    transcript_refseq = fields.CharField(max_length=64, description="转录本参考序列")
    count = fields.IntField(max_length=256, description="数量")
    tpm = fields.FloatField(description="tpm")
    fpkm = fields.FloatField(description="fpkm")
    probe_nm = fields.CharField(max_length=20, description="探针编号")
    pool_id = fields.CharField(max_length=32, description="池标识")
    var_id = fields.CharField(max_length=32, null=True, description="变异标识")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    batch = fields.CharField(max_length=256, null=True, description="批次")
    is_show = fields.IntField(default=0, description="是否展示，0-不展示，1-展示")
    final = fields.CharField(max_length=32, description="审核最终结果")
    sort_code = fields.IntField(null=True, description="排序编码")
    gene_func = fields.CharField(max_length=64, null=True, description="基因功能")
    gene_id = fields.IntField(max_length=32, null=True, description="基因标识")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_seq_rna_exp"


class PSeqRnaSv(Model):
    """
    Produce seq RNA sv model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=32, description="样品标识")
    library_id = fields.CharField(max_length=32, description="文库标识")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    var_id = fields.CharField(max_length=32, null=True, description="变异标识")
    is_remove = fields.IntField(default=0, description="是否不加入报告中，默认false，不去掉，true则去掉，不加入报告")
    is_matched = fields.IntField(default=0, description="是否匹配到知识库，默认false，没有匹配，true则去掉，已经匹配")
    flowcell_lane = fields.CharField(max_length=200, description="芯片泳道")
    var_origin = fields.CharField(max_length=200, description="变异源")
    five_prime_gene = fields.CharField(max_length=200, description="5基因")
    five_prime_transcript = fields.CharField(max_length=200, description="5基因转录本")
    five_prime_cds = fields.CharField(max_length=200, description="5基因cds")
    five_prime_chr = fields.CharField(max_length=200, description="5基因染色体")
    five_prime_chr_pos = fields.CharField(max_length=200, description="5基因染色体位点")
    five_prime_flag = fields.CharField(max_length=200, null=True, description="5基因标识符")
    three_prime_gene = fields.CharField(max_length=200, description="3基因")
    three_prime_transcript = fields.CharField(max_length=200, description="3基因转录本")
    three_prime_cds = fields.TextField(null=True, description="3基因cds")
    three_prime_chr = fields.CharField(max_length=200, description="3基因染色体")
    three_prime_chr_pos = fields.CharField(max_length=200, description="3基因染色体位点")
    three_prime_flag = fields.CharField(max_length=200, null=True, description="3基因标识符")
    var_category_ids = fields.CharField(max_length=128, null=True, description="变异分类标识集合")
    freq = fields.FloatField(null=True, description="频率")
    sequence = fields.TextField(null=True, description="序列号")
    supp_splt_reads = fields.FloatField(description="读长分片")
    supp_span_reads = fields.FloatField(description="读长范围")
    five_prime_supp_reads = fields.FloatField(description="5基因读长")
    three_prime_supp_reads = fields.FloatField(description="3基因读长")
    pct = fields.CharField(max_length=128, description="pct")
    tag = fields.CharField(max_length=128, description="标签")
    batch = fields.CharField(max_length=256, null=True, description="批次")
    is_show = fields.IntField(default=0, description="是否展示，0-不展示，1-展示")
    final = fields.CharField(max_length=32, description="审核最终结果")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    sort_code = fields.IntField(null=True, description="排序编码")
    var_quality = fields.CharField(max_length=32, null=True, description="变异能力")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")
    var_category_names = fields.CharField(max_length=200, null=True, description="变异分类名称集合")

    class Meta:
        table = "tbl_p_seq_rna_sv"


class PSeqtypeDataset(Model):
    """
    Produce seq type dataset model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    seqtype_code = fields.CharField(max_length=32, description="序列号类型编码")
    dataset_code = fields.CharField(max_length=32, description="资料组编码")
    note = fields.CharField(max_length=200, null=True, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_p_seqtype_dataset"


class PSnvindel(Model):
    """
    Produce snvindel model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=64, index=True, description="样本编号")
    library_id = fields.CharField(max_length=32, description="样本编号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    flowcell_lane = fields.CharField(max_length=32, description="芯片泳道")
    chr = fields.CharField(max_length=32, description="染色体，1~22，x, y")
    start = fields.CharField(max_length=32, description="染色体起始位置")
    end = fields.CharField(max_length=32, description="染色体结束位置")
    ref = fields.CharField(max_length=32, description="染色体参考序列")
    alt = fields.CharField(max_length=32, description="染色体变异序列")
    context = fields.CharField(max_length=128, description="碱基序列")
    depth = fields.FloatField(description="深度")
    freq = fields.FloatField(description="频率")
    tag = fields.CharField(max_length=128, description="标签")
    type = fields.CharField(max_length=32, description="变异类型")
    gene_id = fields.IntField(max_length=32, description="基因ID，NCBI gene id")
    gene_region = fields.CharField(max_length=200, description="外显子")
    hgvs_c = fields.CharField(max_length=200, description="c点")
    hgvs_p = fields.CharField(max_length=200, description="p点")
    gene_symbol = fields.CharField(max_length=32, description="基因名称，原字段Gene")
    depth_rs = fields.FloatField(description="rs深度")
    freq_rs = fields.FloatField(description="rs频率")
    var_rs = fields.FloatField(description="rs变异")
    depth_rc = fields.FloatField(description="rc深度")
    freq_rc = fields.FloatField(description="rc频率")
    var_rc = fields.FloatField(description="rc变异")
    depth_ss = fields.FloatField(description="ss深度")
    freq_ss = fields.FloatField(description="ss频率")
    var_ss = fields.FloatField(description="ss变异")
    depth_sc = fields.FloatField(description="sc深度")
    freq_sc = fields.FloatField(description="sc频率")
    var_sc = fields.FloatField(description="sc变异")
    depth_ds = fields.FloatField(description="ds深度")
    freq_ds = fields.FloatField(description="ds频率")
    var_ds = fields.FloatField(description="ds变异")
    depth_dc = fields.FloatField(description="dc深度")
    freq_dc = fields.FloatField(description="dc频率")
    var_dc = fields.FloatField(description="dc变异")
    var_origin = fields.CharField(max_length=32, description="变异来源")
    is_remove = fields.IntField(default=0, description="是否不加入报告中，默认false，不去掉，true则去掉，不加入报告")
    is_matched = fields.IntField(default=0, description="是否匹配到知识库，默认false，没有匹配，true则去掉，已经匹配")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    transcript_primary = fields.CharField(max_length=200, null=True, description="转录本号")
    cds = fields.TextField(null=True, description="cds")
    dbsnp = fields.TextField(null=True, description="dbsnp序列")
    clinvar_id = fields.TextField(description="变异在ClinVar数据库中的ID，")
    cosmic = fields.CharField(max_length=32, null=True, description="cosmic数据库")
    wbc = fields.CharField(max_length=32, null=True, description="白细胞")
    var_acmg_rule = fields.CharField(max_length=32, null=True, description="胚系变异ACMG规则判定，原字段rating")
    var_classification = fields.CharField(max_length=32, null=True, description="变异分类等级结果，值来自知识库，原字段Signification, Determine")
    reference = fields.TextField(null=True, description="参考文献")
    gnomad = fields.CharField(max_length=32, null=True, description="gnomad数据库")
    lkg_eas = fields.CharField(max_length=32, null=True, description="lkg eas")
    depth_total = fields.CharField(max_length=32, null=True, description="总深度")
    freq_total = fields.CharField(max_length=32, null=True, description="总频率")
    var_total = fields.CharField(max_length=32, null=True, description="总变异")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    var_alias = fields.CharField(max_length=32, null=True, description="变异的其他命名")
    var_ivs = fields.CharField(max_length=32, null=True, description="IVS命名")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    gene_transcript = fields.CharField(max_length=200, null=True, description="转录本号")
    genotpye = fields.CharField(max_length=32, null=True, description="基因型")
    halpotype = fields.CharField(max_length=32, null=True, description="单体型")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    var_id_kb = fields.CharField(max_length=32, null=True, description="原表字段ID, 改变异在原知识库版本中的变异id编号")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    var_chain_ds = fields.CharField(max_length=255, null=True, description="ds变异链")
    var_chain_rs = fields.CharField(max_length=255, null=True, description="rs变异链")
    var_chain_ss = fields.CharField(max_length=255, null=True, description="ss变异链")
    tag1 = fields.CharField(max_length=255, null=True, description="标签1")
    Score = fields.CharField(max_length=32, null=True, description="分值")
    ploidy = fields.CharField(max_length=255, null=True, description="倍体")
    genetype = fields.CharField(max_length=256, null=True, description="基因型")
    somatic = fields.CharField(max_length=256, null=True, description="变异来源")
    genetpye = fields.CharField(max_length=256, null=True, description="基因型")
    amplicon_no = fields.CharField(max_length=255, null=True, description="扩增子编号")
    clinvar_clnrevstat = fields.CharField(max_length=255, null=True, description="clinvar clnrevstat")
    clinvar_tgp = fields.CharField(max_length=255, null=True, description="clinvar tgp")
    exac_global = fields.CharField(max_length=255, null=True, description="exac global")
    onekg_afr = fields.CharField(max_length=255, null=True, description="onekg afr")
    onekg_amr = fields.CharField(max_length=255, null=True, description="onekg amr")
    onekg_eas = fields.CharField(max_length=255, null=True, description="onekg eas")
    onekg_eur = fields.CharField(max_length=255, null=True, description="onekg eur")
    onekg_maf = fields.CharField(max_length=255, null=True, description="onekg maf")
    onekg_sas = fields.CharField(max_length=255, null=True, description="onekg sas")
    var_classification_clinvar = fields.CharField(max_length=255, null=True, description="clinvar 变异分类方法")
    var_classification_cosmic = fields.CharField(max_length=255, null=True, description="cosmic变异分类方法")
    var_id = fields.CharField(max_length=256, index=True, null=True, description="变异标识")
    hgvs_p_id = fields.CharField(max_length=200, null=True, description="p点标识")
    var_category_ids = fields.CharField(max_length=200, null=True, description="变异种类标识集合")
    var_category_names = fields.CharField(max_length=200, null=True, description="变异种类名称集合")
    depth_case = fields.FloatField(null=True, description="体细胞变异测序深度")
    depth_ctrl = fields.FloatField(null=True, description="胚系变异测序深度")
    final = fields.CharField(max_length=32, null=True, description="审核最终结果")
    freq_case = fields.FloatField(null=True, description="体细胞变异丰度")
    freq_ctrl = fields.FloatField(null=True, description="胚系变异丰度")
    igvplot = fields.CharField(max_length=256, null=True, description="igv截图的相对路径")
    sort_code = fields.IntField(null=True, description="排序编码")
    hgvs_p_abbr = fields.CharField(max_length=128, null=True, description="氨基酸三字母简写的HGVS变异命名")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_snvindel"


class PSv(Model):
    """
    Produce sv model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=64, description="样本编号")
    library_id = fields.CharField(max_length=32, description="文库编号")
    flowcell_lane = fields.CharField(max_length=32, description="芯片泳道")
    tag = fields.CharField(max_length=128, description="标签")
    inferred_breakpoint = fields.TextField(null=True, description="打断点")
    depth = fields.FloatField(description="深度")
    freq = fields.FloatField(description="频率")
    raw = fields.FloatField(description="原数据")
    ssbc = fields.FloatField(description="ssbc")
    dsbc = fields.FloatField(description="dsbc")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    sequence = fields.TextField(null=True, description="碱基序列")
    var_origin = fields.CharField(max_length=32, description="变异来源")
    qc1_operate_state = fields.IntField(default=0, description="qc1判定状态")
    qc2_operate_state = fields.IntField(default=0, description="qc2判定状态")
    var_alias = fields.CharField(max_length=32, description="变异的其他命名")
    var_hgvs = fields.TextField(null=True, description="hgvs变异准则")
    data_status = fields.IntField(default=0, description="记录该条数据是否是原始数据或者是修改数据或新增数据类别,0或null标识原始，1修改，2新增")
    five_prime_cds = fields.TextField(null=True, description="结构变异5端cds")
    five_prime_chr = fields.CharField(max_length=200, description="结构变异5端染色体号，原字段 Chr1")
    five_prime_chr_pos = fields.CharField(max_length=200, description="结构变异5端染色体位置")
    five_prime_flag = fields.CharField(max_length=200, description="结构变异5端标识符")
    five_prime_gene = fields.CharField(max_length=200, description="5端基因名称")
    five_prime_transcript = fields.CharField(max_length=200, description="结构变异5端转录本")
    three_prime_cds = fields.TextField(null=True, description="结构变异3端cds")
    three_prime_chr = fields.CharField(max_length=200, description="结构变异3端染色体")
    three_prime_chr_pos = fields.CharField(max_length=200, description="结构变异3端染色体位置")
    three_prime_flag = fields.CharField(max_length=32, description="结构变异3端标识符")
    three_prime_gene = fields.CharField(max_length=200, description="结构变异3端基因名称")
    three_prime_transcript = fields.CharField(max_length=200, description="结构变异3端转录本")
    is_remove = fields.IntField(default=0, description="是否不加入报告中，默认false，不去掉，true则去掉，不加入报告")
    is_matched = fields.IntField(default=0, description="是否匹配到知识库，默认false，没有匹配，true则去掉，已经匹配")
    var_auto_result = fields.CharField(max_length=32, null=True, description="变异真假自动判定结果")
    var_da1_operator = fields.CharField(max_length=32, null=True, description="变异初审人")
    var_da1_result = fields.CharField(max_length=32, null=True, description="变异初审人判定结果")
    var_da2_operator = fields.CharField(max_length=32, null=True, description="变异复审人")
    var_da2_result = fields.CharField(max_length=32, null=True, description="变异复审人判定结果")
    bioinform_ver = fields.CharField(max_length=32, null=True, description="生信分析pipeline版本")
    var_da1_time = fields.DatetimeField(null=True, description="变异初审人操作时间")
    var_da2_time = fields.DatetimeField(null=True, description="变异复审人操作时间")
    copies = fields.CharField(max_length=200, null=True, description="复制数")
    var_id = fields.CharField(max_length=255, null=True, description="变异标识")
    var_category_ids = fields.CharField(max_length=200, null=True, description="变异种类标识集合")
    var_category_names = fields.CharField(max_length=200, null=True, description="变异种类名称集合")
    depth_case = fields.FloatField(null=True, description="体细胞变异测序深度")
    depth_ctrl = fields.FloatField(null=True, description="胚系变异测序深度")
    final = fields.CharField(null=True, max_length=32, description="审核最终结果")
    freq_case = fields.FloatField(null=True, description="体细胞变异丰度")
    freq_ctrl = fields.FloatField(null=True, description="胚系变异丰度")
    igvplot = fields.CharField(max_length=256, null=True, description="igv截图的相对路径")
    sort_code = fields.IntField(null=True, description="排序编码")
    json_batch_name = fields.CharField(max_length=200, null=True, description="批次编号")

    class Meta:
        table = "tbl_p_sv"


class PTmb(Model):
    """
    Produce tmb model
    """
    DEL = (
        (0, "未废弃"),
        (1, "已废弃")
    )
    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    created_user = fields.CharField(max_length=32, null=True, description="创建人")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    tumor_name_bims = fields.CharField(max_length=200, description="肿瘤名称")
    tumor_id = fields.CharField(max_length=200, null=True, description="肿瘤标识")
    tmb_value = fields.FloatField(description="tmb值")
    origin = fields.TextField(null=True, description="来源")
    pipeline = fields.TextField(null=True, description="途径")
    pipeline_ver = fields.CharField(max_length=64, description="途径版本")
    panel_ver = fields.CharField(max_length=64, description="探针版本")
    img_filename = fields.CharField(max_length=200, null=True, description="图片名称")
    img_path = fields.CharField(max_length=200, null=True, description="图片路径")
    delete_time = fields.DatetimeField(null=True, description="逻辑删除时间")
    is_delete = fields.IntField(choices=DEL, default=0, description="是否废弃，0-未废弃，1-废弃")

    class Meta:
        table = "tbl_p_tmb"


class PTmbBase(Model):
    """
    Produce tmb base model
    """

    DEL = (
        (0, "未废弃"),
        (1, "已废弃")
    )
    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    created_user = fields.CharField(max_length=32, null=True, description="创建人")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    tumor_name_bims = fields.CharField(max_length=200, description="肿瘤名称")
    tumor_id = fields.CharField(max_length=200, null=True, description="肿瘤标识")
    tmb_value = fields.FloatField(description="tmb值")
    origin = fields.TextField(null=True, description="来源")
    pipeline = fields.TextField(null=True, description="途径")
    pipeline_ver = fields.CharField(max_length=64, description="途径版本")
    panel_ver = fields.CharField(max_length=64, description="探针版本")
    img_filename = fields.CharField(max_length=200, null=True, description="图片名称")
    img_path = fields.CharField(max_length=200, null=True, description="图片路径")

    class Meta:
        table = "tbl_p_tmb_base"


class PVarCategory(Model):
    """
    Produce var category model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    sample_id = fields.CharField(max_length=100, index=True, description="样本标识")
    var_id = fields.CharField(max_length=100, description="变异标识")
    freq = fields.FloatField(description="频率")
    var_category_id = fields.CharField(max_length=32, null=True, description="变异种类标识")
    var_origin = fields.CharField(max_length=64, description="变异来源，somatic or germline")
    hgvs_p_id = fields.CharField(max_length=64, null=True, description="p点标识")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    create_uid = fields.IntField(null=True, description="创建人")
    freq_case = fields.CharField(max_length=200, null=True, description="体细胞变异丰度")
    freq_ctrl = fields.CharField(max_length=200, null=True, description="胚系变异丰度")
    last_editor = fields.IntField(null=True, description="编辑人")
    updated_time = fields.DatetimeField(null=True, description="更新时间")
    delete_time = fields.DatetimeField(null=True, description="逻辑删除时间")
    is_delete = fields.IntField(default=0, description="逻辑删除")
    preferred_name = fields.CharField(max_length=128, null=True, description="首选名称")

    class Meta:
        table = "tbl_p_var_category"


class PVarGInterpretation(Model):
    """
    Produce var g interpretation model
    """
    DEL = (
        (0, "未废弃"),
        (1, "已废弃")
    )
    var_g_interpretation_id = fields.IntField(pk=True, description="标识")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    var_id = fields.CharField(max_length=32, description="变异标识")
    ba1_reason = fields.IntField(default=0, description="ba1原因")
    ba1_result = fields.TextField(null=True, description="ba1结果")
    bs1_reason = fields.IntField(default=0, description="bs1原因")
    bs1_result = fields.TextField(null=True, description="bs1结果")
    bs2_reason = fields.IntField(default=0, description="bs2原因")
    bs2_result = fields.TextField(null=True, description="bs2结果")
    bs3_reason = fields.IntField(default=0, description="bs3原因")
    bs3_result = fields.TextField(null=True, description="bs3结果")
    bs4_reason = fields.IntField(default=0, description="bs4原因")
    bs4_result = fields.TextField(null=True, description="bs4结果")
    bp1_reason = fields.IntField(default=0, description="bp1原因")
    bp1_result = fields.TextField(null=True, description="bp1结果")
    bp2_reason = fields.IntField(default=0, description="bp2原因")
    bp2_result = fields.TextField(null=True, description="bp2结果")
    bp3_reason = fields.IntField(default=0, description="bp3原因")
    bp3_result = fields.TextField(null=True, description="bp3结果")
    bp4_reason = fields.IntField(default=0, description="bp4原因")
    bp4_result = fields.TextField(null=True, description="bp4结果")
    bp5_reason = fields.IntField(default=0, description="bp5原因")
    bp5_result = fields.TextField(null=True, description="bp5结果")
    bp6_reason = fields.IntField(default=0, description="bp6原因")
    bp6_result = fields.TextField(null=True, description="bp6结果")
    bp7_reason = fields.IntField(default=0, description="bp7原因")
    bp7_result = fields.TextField(null=True, description="bp7结果")
    pp1_reason = fields.IntField(default=0, description="pp1原因")
    pp1_result = fields.TextField(null=True, description="pp1结果")
    pp2_reason = fields.IntField(default=0, description="pp2原因")
    pp2_result = fields.TextField(null=True, description="pp2结果")
    pp3_reason = fields.IntField(default=0, description="pp3原因")
    pp3_result = fields.TextField(null=True, description="pp3结果")
    pp4_reason = fields.IntField(default=0, description="pp4原因")
    pp4_result = fields.TextField(null=True, description="pp4结果")
    pp5_reason = fields.IntField(default=0, description="pp5原因")
    pp5_result = fields.TextField(null=True, description="pp5结果")
    pm1_reason = fields.IntField(default=0, description="pm1原因")
    pm1_result = fields.TextField(null=True, description="pm1结果")
    pm2_reason = fields.IntField(default=0, description="pm2原因")
    pm2_result = fields.TextField(null=True, description="pm2结果")
    pm3_reason = fields.IntField(default=0, description="pm3原因")
    pm3_result = fields.TextField(null=True, description="pm3结果")
    pm4_reason = fields.IntField(default=0, description="pm4原因")
    pm4_result = fields.TextField(null=True, description="pm4结果")
    pm5_reason = fields.IntField(default=0, description="pm5原因")
    pm5_result = fields.TextField(null=True, description="pm5结果")
    pm6_reason = fields.IntField(default=0, description="pm6原因")
    pm6_result = fields.TextField(null=True, description="pm6结果")
    ps1_reason = fields.IntField(default=0, description="ps1原因")
    ps1_result = fields.TextField(null=True, description="ps1结果")
    ps2_reason = fields.IntField(default=0, description="ps2原因")
    ps2_result = fields.TextField(null=True, description="ps2结果")
    ps3_reason = fields.IntField(default=0, description="ps3原因")
    ps3_result = fields.TextField(null=True, description="ps3结果")
    ps4_reason = fields.IntField(default=0, description="ps4原因")
    ps4_result = fields.TextField(null=True, description="ps4结果")
    pvs1_reason = fields.IntField(default=0, description="pvs1原因")
    pvs1_result = fields.TextField(null=True, description="pvs1结果")
    var_acmg_classification = fields.CharField(max_length=256, description="acmg变异分类法")
    var_interpretation = fields.TextField(null=True, description="")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.CharField(max_length=256, description="更新人")
    created_user = fields.CharField(max_length=256, description="创建人")
    role = fields.CharField(max_length=32, description="角色")
    state = fields.IntField(default=0, description="0,1,2表示不同权限修改的状态，0-原数据，1-审核1，2-审核2，3-修改")
    is_delete = fields.IntField(choices=DEL, default=0, description="是否废弃，0-未废弃，1-废弃")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    status = fields.IntField(default=1, description="状态")
    update_note = fields.TextField(null=True, description="备注")
    var_interpretation_en = fields.TextField(null=True, description="")
    delete_time = fields.DatetimeField(null=True, description="逻辑删除时间")

    class Meta:
        table = "tbl_p_var_g_interpretation"
        indexes = ("var_id", "sample_id")


class PVarGermPrefilter(Model):
    """
    Produce var germ prefilter model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    gene_symbol = fields.CharField(max_length=64, description="基因标志")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    created_user = fields.CharField(max_length=256, dnull=True, escription="创建人")
    gene_id = fields.IntField(max_length=32, description="")
    note = fields.TextField(null=True, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_p_var_germ_prefilter"


class PVarSInterpretation(Model):
    """
    Produce var s interpretation model
    """
    DEL = (
        (0, "未废弃"),
        (1, "已废弃")
    )
    var_s_interpretation_id = fields.IntField(pk=True, description="标识")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    var_id = fields.CharField(max_length=200, description="变异标识")
    sample_id = fields.CharField(max_length=32, index=True, description="样品标识")
    tumor_id = fields.CharField(max_length=64, null=True, description="肿瘤标识")
    tumor_name = fields.CharField(max_length=256, null=True, description="肿瘤名称")
    var_interpretation = fields.TextField(null=True, description="变异解读")
    var_func = fields.TextField(null=True, description="变异功能")
    update_record = fields.TextField(null=True, description="更新记录")
    note = fields.TextField(null=True, description="备注")
    var_oncogenicity = fields.IntField(null=True, description="变异致瘤性")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    created_user = fields.CharField(max_length=256, description="创建人")
    role = fields.CharField(max_length=32, description="角色")
    state = fields.IntField(default=0, description="0,1,2表示不同权限修改的状态，0-原数据，1-审核1，2-审核2，3-修改")
    is_delete = fields.IntField(choices=DEL, default=0, description="是否废弃，0-未废弃，1-废弃")
    var_interpretation_en = fields.TextField(null=True, description="")
    delete_time = fields.DatetimeField(null=True, description="逻辑删除时间")

    class Meta:
        table = "tbl_p_var_s_interpretation"
        indexes = ("var_id", "sample_id")


class ProcessFlow(Model):
    """
    Process flow model
    """

    id = fields.IntField(pk=True, description="标识")
    name = fields.CharField(max_length=32, description="名称")
    code = fields.CharField(max_length=32, description="编码")

    class Meta:
        table = "tbl_process_flow"


class Project(Model):
    """
    Project model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    create_uid = fields.IntField(null=True, description="创建人")
    write_uid = fields.IntField(null=True, description="更新人")
    name = fields.CharField(max_length=128, description="项目名称")
    code = fields.CharField(max_length=32, unique=True, description="项目编码")
    remark = fields.CharField(max_length=255, description="")
    project_category: fields.ForeignKeyRelation["ProjectCategory"] = \
        fields.ForeignKeyField("models.ProjectCategory", related_name="pro_var")
    prod_id = fields.IntField(description="产品id")

    class Meta:
        table = "tbl_project"


class ProjectCategory(Model):
    table = "tbl_project_category"

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    create_uid = fields.IntField(null=True, description="创建人")
    write_uid = fields.IntField(null=True, description="更新人")
    name = fields.CharField(max_length=128, description="项目分类名称")
    code = fields.CharField(max_length=32, unique=True, description="项目分类编码")
    remark = fields.CharField(max_length=255, description="")

    pro_var: fields.ReverseRelation["Project"]


class ReportFile(Model):
    """
    Report file model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    create_uid = fields.IntField(null=True, description="创建人")
    write_uid = fields.IntField(null=True, description="更新人")
    order_id = fields.IntField(description="订单标识")
    file_name = fields.CharField(max_length=256, description="文件名称")
    full_path = fields.CharField(max_length=256, description="完整路径")
    path = fields.CharField(max_length=256, description="路径")
    modify_date = fields.DatetimeField(null=True, description="更新时间")
    type = fields.CharField(max_length=256, description="文档类型，pdf,word")
    task_id = fields.CharField(max_length=64, null=True, description="任务标识")
    task_state = fields.CharField(max_length=32, null=True, description="任务状态")
    push_date = fields.DatetimeField(null=True, description="推送时间")
    push_state = fields.IntField(null=True, description="推送状态")

    class Meta:
        table = "tbl_report_file"


class RptCompanyCode(Model):
    """
    Rpt company code model
    """

    id = fields.IntField(pk=True, description="标识")
    applyCompanyNo = fields.CharField(max_length=200, description="送检单位编号")
    applyCompanyNm = fields.CharField(max_length=200, description="送检单位名称")

    class Meta:
        table = "tbl_rpt_CompanyCode"


class RptBrcaDrug(Model):
    """
    Rpt brca drug  model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    regimen_id = fields.CharField(max_length=255, description="方案标识")
    drug_id = fields.CharField(max_length=255, description="药物标识")
    general_name_en = fields.CharField(max_length=255, description="通用名称-英文")
    general_name_cn = fields.CharField(max_length=255, description="通用名称-中文")
    trade_name_en = fields.CharField(max_length=255, null=True, description="商标-英文")
    trade_name_cn = fields.CharField(max_length=255, null=True, description="商标-中文")
    approval_fda = fields.IntField(description="fda标准")
    approval_nmpa = fields.IntField(description="nmpa标准")
    drug_mechanism_cn = fields.TextField(null=True, description="药物机制-中文")
    drug_biomarker = fields.TextField(null=True, description="药物生物标志物")
    drug_indication = fields.TextField(null=True, description="药物标示")
    is_delete = fields.IntField(default=0, description="是否删除")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    creator = fields.CharField(max_length=32, null=True, description="创建人")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")
    last_time = fields.DatetimeField(null=True, description="编辑时间")

    class Meta:
        table = "tbl_rpt_brca_drug"


class RptBrcaEvi(Model):
    """
    Rpt brca evi model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    brca_result = fields.CharField(max_length=255, description="结果")
    tumor_id = fields.IntField(description="肿瘤标识")
    tumor_names_cn = fields.CharField(max_length=255, description="肿瘤名称")
    therapy_evidence = fields.TextField(description="治疗证据")
    is_delete = fields.IntField(default=0, description="是否删除")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    creator = fields.CharField(max_length=32, null=True, description="创建人")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")
    last_time = fields.DatetimeField(null=True, description="编辑时间")

    class Meta:
        table = "tbl_rpt_brca_evi"


class RptBrcaRecomm(Model):
    """
    Rpt brca recomm model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    tumor_id = fields.IntField(description="肿瘤标识")
    tumor_names_cn = fields.CharField(max_length=255, description="肿瘤名称")
    classification_people = fields.CharField(max_length=255, description="人群分类")
    testing_recommendations = fields.TextField(null=True, description="测试建议")
    biomarker = fields.TextField(null=True, description="生物标志物")
    is_delete = fields.IntField(default=0, description="是否删除")
    sample_type = fields.CharField(max_length=255, description="")
    brca_result = fields.CharField(max_length=255, description="")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    creator = fields.CharField(max_length=32, null=True, description="创建人")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")
    last_time = fields.DatetimeField(null=True, description="编辑时间")

    class Meta:
        table = "tbl_rpt_brca_recomm"


class RptConfigdescription(Model):
    """
    Rpt config description model
    """

    id = fields.IntField(pk=True, description="标识")
    company_code = fields.CharField(max_length=200, description="")
    company = fields.CharField(max_length=200, description="")
    prod_id = fields.CharField(max_length=200, description="")
    bims_inspectionIterm_name = fields.CharField(max_length=200, description="")
    template_type_id = fields.CharField(max_length=200, description="")
    template_type = fields.CharField(max_length=200, description="")
    report_number = fields.CharField(max_length=200, description="")
    apply_code = fields.CharField(max_length=200, description="")
    validity = fields.CharField(max_length=200, description="")
    activation_time = fields.CharField(max_length=200, description="")
    deactivation_time = fields.CharField(max_length=200, description="")
    
    class Meta:
        table = "tbl_rpt_config_description"


class RptIoGeneClinical(Model):
    """
    Rpt io gene clinical model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    gene_id = fields.IntField(description="基因标识")
    gene_symbol = fields.CharField(max_length=32, description="基因标记")
    var_note = fields.CharField(max_length=200, description="变异备注")
    effect = fields.CharField(max_length=200, description="影响，正相关 or 负相关")
    effect_en = fields.CharField(max_length=256, description="影响-英文")
    test_significance = fields.TextField(null=True, description="检测意义")
    test_significance_en = fields.TextField(null=True, description="检测意义-英文")
    evidence = fields.TextField(null=True, description="证据")
    evidence_en = fields.TextField(null=True, description="证据-英文")
    note = fields.TextField(null=True, description="备注")
    tumor_id = fields.IntField(null=True, description="肿瘤标识")
    tumor_name = fields.CharField(max_length=256, null=True, description="肿瘤名称")
    clinical_significance = fields.TextField(null=True, description="临床意义")

    class Meta:
        table = "tbl_rpt_io_gene_clinical"


class RptReportingRequirement(Model):
    """
    Rpt reporting requirement model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    report_module_type_cn = fields.CharField(max_length=128, description="报告模板类型-中文：通用版、定制版")
    report_module_type = fields.CharField(max_length=128, description="报告模板类型-英文：Universal、CustomEdition")
    business_type_cn = fields.CharField(max_length=128, description="业务类型-中文：医院、临检")
    business_type = fields.CharField(max_length=128, description="业务类型-英文：hospital、rummage")
    panel_name = fields.CharField(max_length=64, description="探针名称")
    prod_id = fields.IntField(description="产品标识")
    panel_ver = fields.CharField(max_length=64, null=True, description="探针版本")
    applyCompanyNm = fields.CharField(max_length=64, null=True, sodescription="送检单位名称")
    applyCompanyNo = fields.IntField(null=True, description="送检单位编号")
    report_number = fields.CharField(max_length=64, null=True, description="报告编号")
    apply_code = fields.CharField(max_length=64, null=True, description="送检编码")
    module_info_num = fields.CharField(max_length=64, null=True, description="模块信息编号")
    report_name = fields.CharField(max_length=128, null=True, description="报告名称")
    status = fields.IntField(default=0, description="状态")
    shell_name = fields.CharField(max_length=128, null=True, description="脚本名称")
    note = fields.CharField(max_length=200, null=True, description="备注")
    username = fields.CharField(max_length=64, null=True, description="用户名")
    auditors = fields.CharField(max_length=64, null=True, description="审核人")
    auditors_time = fields.DatetimeField(null=True, description="审核时间")
    auditors_status = fields.IntField(null=True, description="审核状态")
    developer = fields.CharField(max_length=64, null=True, description="开发者")
    developer_start_time = fields.CharField(max_length=64, null=True, description="开始时间")
    developer_end_time = fields.CharField(max_length=64, null=True, description="结束时间")
    developer_status = fields.IntField(default=1, description="开发状态")

    class Meta:
        table = "tbl_rpt_reporting_requirement"


class RptTemplateProdList(Model):
    """
    Rpt template prod list model
    """

    id = fields.IntField(pk=True, description="标识")
    prod_id = fields.IntField(max_length=200, description="产品标识")
    bims_inspection_item_name = fields.CharField(max_length=200, description="检查项名称")
    template_type_id = fields.IntField(description="模板类型标识")
    template_type = fields.CharField(max_length=200, description="模板类型")
    judge_pdl1 = fields.IntField(default=0, description="pdl1判定")
    version = fields.CharField(max_length=32, description="版本")
    prod_template_name = fields.CharField(max_length=200, description="产品模板名称")
    validity = fields.IntField(default=1, description="有效性")
    activation_time = fields.CharField(max_length=200, null=True, description="活性时间")
    deactivation_time = fields.CharField(max_length=200, null=True, description="失活时间")

    class Meta:
        table = "tbl_rpt_template_prod_list"


class ScheduleJobRecord(Model):
    """
    Schedule job record model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    job_time = fields.DatetimeField(description="同步时间")
    code = fields.CharField(max_length=200, description="同步代码")
    job_name = fields.CharField(max_length=200, description="同步名称")
    job_name_desc = fields.CharField(max_length=200, description="同步功能描述")
    job_is_success = fields.IntField(default=0, description="同步是否成功")
    error_log_path = fields.CharField(max_length=200, null=True, description="错误日志")
    deleted_time = fields.DatetimeField(null=True, description="逻辑删除时间")
    is_deleted = fields.IntField(default=0, description="逻辑删除")
    error_log = fields.TextField(null=True, description="错误信息")
    warning_log = fields.TextField(null=True, description="警告信息")
    md5_check_error_message = fields.TextField(null=True, description="md5校验错误信息")
    not_related_sample_ids = fields.TextField(null=True, description="未关联的样品id")
    related_sample_ids = fields.TextField(null=True, description="已关联的样品id")
    update_time = fields.DatetimeField(null=True, description="更新时间")

    class Meta:
        table = "schedule_job_record"


class SeqDictDataset(Model):
    """
    Seq dict dataset model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    dataset_code = fields.CharField(max_length=32, description="编码")
    dataset_value = fields.CharField(max_length=32, description="值")
    description = fields.CharField(max_length=32, description="描述")
    editor = fields.CharField(max_length=32, null=True, description="编辑人")
    type = fields.CharField(max_length=65, description="类型")

    class Meta:
        table = "seq_dict_dataset"


class SnvImage(Model):
    table = "snv_image"

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    path = fields.CharField(max_length=200, description="路径")
    img_name = fields.CharField(max_length=200, description="图片名称")
    sample_id = fields.CharField(max_length=200, description="样品标识")
    order_id = fields.IntField(description="订单标识")
    prod_ids = fields.CharField(max_length=200, description="产品标识集合")
    prod_names = fields.CharField(max_length=200, null=True, description="产品名称集合")
    delete_time = fields.DatetimeField(null=True, description="逻辑删除时间")
    is_delete = fields.IntField(default=0, description="逻辑删除")


class SyncRecord(Model):
    """
    Sync record model
    """

    id = fields.IntField(pk=True, description="标识")
    code = fields.CharField(max_length=200, description="同步代码")
    sync_name = fields.CharField(max_length=200, description="同步名称")
    sync_name_desc = fields.CharField(max_length=200, description="同步功能描述")
    sync_time = fields.DatetimeField(null=True, description="同步时间")
    current_id = fields.IntField(description="当前同步至id号")

    class Meta:
        table = "tbl_sync_record"


class TerminalFile(Model):
    """
    Terminal file model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    create_uid = fields.IntField(null=True, description="创建人")
    write_uid = fields.IntField(null=True, description="更新人")
    file_name = fields.CharField(max_length=256, description="文件名")
    abspath = fields.CharField(max_length=256, description="绝对路径")
    relative_path = fields.CharField(max_length=256, null=True, description="相对路径")
    modify_date = fields.DatetimeField(null=True, description="更改时间")
    is_dir = fields.IntField(default=0, description="")

    class Meta:
        table = "tbl_terminal_file"
